#@laybase() #define main()

<div class="row" id="contentThis">
	<div class="col-md-10">
		<div
			style="display: table; width: auto; margin-left: auto; margin-right: auto;">
			#@picview()</div>
	</div>
	<div class="col-md-2 scrollbox">
		<ul class="nav well" id="nav-pills">
			<li><a data-toggle="collapse" data-target="#原件照片" href="#">原件照片</a></li>
			#setLocal(xmlList=getMakeprice_creds()) #setLocal(modName =
			"orderMakepriceCred")
			<ul class="collapse" id="原件照片">
				#for(xml:xmlList) #setLocal(srcList =
				yw.dm.base.DataUtils::transStringToMap(credInfo.get(xml.paramterName)??""))
				#if(xml.sonTab!=null&&xml.sonTab.length()>0&&srcList.size()>0)
				#setLocal(stateList =
				credInfo.get(xml.paramterName+"Sta")!=null?credInfo.get(xml.paramterName+"Sta").split(","):null)
				<p>
					<a href="#" data-toggle="collapse" data-target="#coll#(xml.zhExpl)">#(xml.zhExpl)</a>
				</p>
				<ul class="collapse" id="coll#(xml.zhExpl)">
					#setLocal(sons = xml.sonTab.split(","))
					#if(xml.sonTab.indexOf("auto")!=-1) #set(sons =
					[1..srcList.size()]) #end #for(son : sons) #setLocal(state =
					stateList!=null?stateList[for.index]:'')
					<li><a href="#" data-src="#(srcList.get(for.index+'')??'')"
						data-state="#(state)"
						name="#(modName).#(xml.paramterName)_#(for.index)"
						data-exp="#(xml.zhExpl)_#(son)" onclick="select(this)">#(xml.zhExpl)-#(son)</a></li>
					#end
				</ul>
				#else #setLocal(src=credInfo.get(xml.paramterName))
				#setLocal(state=credInfo.get(xml.paramterName+"Sta")??'')
				<p>
					<a href="#" data-src="#(src??'')"
						name="#(modName).#(xml.paramterName)" data-state="#(state)"
						data-exp="#(xml.zhExpl)" onclick="select(this)">#(xml.zhExpl)</a>
				</p>
				#end #end
			</ul>
			<li><a href="#" data-toggle="collapse" data-target="#车辆照片">车辆照片</a></li>
			#setLocal(xmlList=getMakeprice_cars()) #setLocal(modName =
			"orderMakepriceCar")
			<ul class="collapse" id="车辆照片">
				#for(xml:xmlList) #if(xml.sonTab!=null&&xml.sonTab.length()>0)
				<p>
					<a href="#" data-toggle="collapse" data-target="#coll#(xml.zhExpl)">#(xml.zhExpl)</a>
				</p>
				<ul class="collapse" id="coll#(xml.zhExpl)">
					#for(son : xml.sonTab.split(",")) #setLocal(srcList =
					yw.dm.base.DataUtils::transStringToMap(carInfo.get(xml.paramterName)??""))
					#setLocal(stateList =
					credInfo.get(xml.paramterName+"Sta")!=null?credInfo.get(xml.paramterName+"Sta").split(","):null)
					#setLocal(state = stateList!=null?stateList[for.index]:'')
					<li><a href="#" data-src="#(srcList[for.index]??'')"
						data-state="#(state)"
						name="#(modName).#(xml.paramterName)_#(for.index)"
						data-exp="#(xml.zhExpl)_#(son)" onclick="select(this)">#(xml.zhExpl)-#(son)</a></li>
					#end
				</ul>
				#else #setLocal(src=carInfo.get(xml.paramterName))
				#setLocal(state=credInfo.get(xml.paramterName+"Sta")??'')
				<p>
					<a href="#" data-src="#(src??'')"
						name="#(modName).#(xml.paramterName)" data-state="#(state)"
						data-exp="#(xml.zhExpl)" onclick="select(this)">#(xml.zhExpl)</a>
				</p>
				#end #end
			</ul>
		</ul>
	</div>
</div>
<script type="text/javascript">
var index = null
var targetArr = []
var imgArr = []
$(document).ready(function() {
	$("#contentThis a").each(function(idx, elm) {
		if ($(elm).attr("name")!=null&&$(elm).attr("name")!="") {
			targetArr.push(elm)
			freshState(elm)
			$(elm).on("click",function(){index=targetArr.indexOf(this)})
		}
		if(elm.dataset.src!=null&&elm.dataset.src!=""){
			imgArr.push(elm.dataset.src)
		}
	})
	showNextCollapse()
})
function showNextCollapse(){
	if(index==null){
		index=0
	}else{
		index++
	}
	preOnload(index, index+5)
	var elm = targetArr[index]
	elm.click()
	function floor(el,action){
		if (el.hash!=null) {
			$(el.hash).collapse(action)
			floor($(el.hash))
		}else{
			el.click()
		}
	}
	floor(elm,"show")
}
function preOnload(idxStart,idxEnd){
	for (var i = idxStart; i <= idxEnd; i++) {
		if (imgArr[i]!=null&&imgArr[i]!="") {
			var img = new Image()
			img.src = imgArr[i]
		}
	}
}
function freshState(target){
	var str = "";
	var flg = 0
	if (target.dataset.state=="5") {
		str = str+"<span class='glyphicon glyphicon-ok' "+
		"style='color:#00cc33'></span>"+target.innerText
		target.innerHTML = str
		flg = 2
	}else if(target.dataset.state.length > 1) {
		str = str+"<span class='glyphicon glyphicon-remove' "+
		"style='color:#cc0033'></span>"+target.innerText
		target.innerHTML = str
		flg = 1
	}
	$(target).parents("li").siblings("li").find("a").each(function(idx,el){
		if(el.dataset.state=="5"){
		}else if(el.dataset.state.length > 1){
			flg = 1
		}else{
			flg = flg!=1?0:flg
		}
	})
	if(flg!=0){
		$daddy = $(target).parents("ul").prev("p").children()
		if(flg == 2){
			$daddy.html("<span class='glyphicon glyphicon-ok' "+
					"style='color:#00cc33'></span>"+$daddy.text())
		}else if(flg==1){
			$daddy.html("<span class='glyphicon glyphicon-remove' "+
					"style='color:#cc0033'></span>"+$daddy.text())
		}
	}
}
</script>
#end
